<template>
    <div class="action-sheet-item" @click="itemClick">
        <van-image
            width="28"
            height="28"
            :src="Utils.getLocalImageSrc(data.icon)"
        ></van-image>
        <div class="action-sheet-item-label">{{ data.label }}</div>
        <div class="line"></div>
    </div>
</template>

<script lang="ts" setup>
import { PropType, toRefs, defineProps } from "vue";
import HeadItemModel from "../types/headItem";
import Utils from "../utils/utils";

const props = defineProps({
    data: {
        type: Object as PropType<HeadItemModel>,
    },
    index: {
        type: Number,
    },
});
const { data, index } = toRefs(props);

const emit = defineEmits(["itemClick"]);
const itemClick = () => {
    emit("itemClick", index.value);
};
</script>

<style lang="less" scoped>
.action-sheet-item {
    // flex: 1;
    position: relative;
    height: 54px;
    padding-left: 14px;
    display: flex;
    align-items: center;
    // border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);

    &-label {
        margin-left: 14px;
        font-size: 15px;
        color: white;
    }
    .line {
        position: absolute;
        bottom: 0px;
        left: 14px;
        right: 0;
        height: 1px;
        background-color: rgba(255, 255, 255, 0.1);
        // background-color: red;
    }
}
</style>
